# -*- coding: utf-8 -*-

from django.urls import path, include, re_path, reverse
from web.views import account, home, project, dashboard, issues, statistics, wiki, file, setting


urlpatterns = [
    path('register/', account.register, name='register'),
    path('send/sms/', account.send_sms, name='send_sms'),
    path('login/sms/', account.login_sms, name='login_sms'),
    path('image/code/', account.image_code, name='image_code'),
    path('login/', account.login, name='login'),
    path('index/', home.index, name='index'),
    path('logout/', account.logout, name='logout'),

    path('price/', home.price, name='price'),
    # path('payment/<policy_id>/', home.payment, name='payment'),
    path('pay/', home.pay, name='pay'),
    # path('pay/notify/', home.pay_notify, name='pay_notify'),

    # 项目列表
    path('project/list/', project.project_list, name='project_list'),
    path('project/star/<project_type>/<project_id>/', project.project_star, name='project_star'),
    path('project/unstar/<project_type>/<project_id>/', project.project_unstar, name='project_unstar'),

    # 项目管理功能
    path('manage/<project_id>/', include([
        # wiki
        path('wiki/', wiki.wiki, name='wiki'),
        path('wiki/add/', wiki.wiki_add, name='wiki_add'),
        path('wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        path('wiki/delete/<wiki_id>/', wiki.wiki_delete, name='wiki_delete'),
        path('wiki/edit/<wiki_id>/', wiki.wiki_edit, name='wiki_edit'),
        path('wiki/upload/', wiki.wiki_upload, name='wiki_upload'),

        # file
        path('file/', file.file, name='file'),

        # setting
        path('setting/', setting.setting, name='setting'),
        path('setting/delete/', setting.delete, name='setting_delete'),

        # issues
        path('issues/', issues.issues, name='issues'),

        # dashboard 项目详细界面
        path('dashboard/', dashboard.dashboard, name='dashboard'),
        path('dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),

        # statistics
        path('statistics/', statistics.statistics, name='statistics'),
    ], None)),

    # 邀请人加入
    path('invite/join/<code>/', issues.invite_join, name='invite_join'),
]
